package com.acoreful.acf2admin.commons.mq;

import org.apache.thrift.TBase;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;

/**
 *	RabbitMq生产者
 */
@Component
public class RabbitMqProducer implements MqProducer {
	
	@Autowired
	@Qualifier("p2pAmqpTemplate")
	private AmqpTemplate amqpTemplate;
	
	@Override
	public void send(String exchange, String routingKey, TBase<?, ?> message) {
		amqpTemplate.convertAndSend(exchange, routingKey, ThriftUtils.serialize(message));
	}

}
